<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');
    $router->get('auth/outside_login', 'AuthController@getLogin')->name('outside_login');

    $router->group([
        'prefix' => 'auth',
    ], function (Router $router) {
        $router->get('system_setting', 'HomeController@setting');
        $router->get('archive_setting', 'HomeController@archiveSetting');

        $router->put('switch-online', 'AuthController@switchOnline');
        $router->get('last-clue', 'AuthController@getLastClueDate');
        $router->get('grid_of_user', 'UserController@userIndex');


        $router->get('grid_of_user', 'UserController@userIndex');
        $router->resource('users', "UserController");

    });

    $router->group([
        'prefix' => 'user_group',
    ], function (Router $router) {
        $router->put('users/{id}', "UserGroupController@updateUsers");
        $router->get('/{id}/edit-users', "UserGroupController@editUsers");

    });
    $router->resource('user_group', 'UserGroupController');


    $router->group([
        'prefix' => 'clues',
    ], function (Router $router) {
        $router->get('user', 'ClueController@index')->name('admin.clue.user');
    });

    $router->group([
        'prefix' => 'api'
    ], function (Router $router) {
        $router->get('city', "HomeController@getCity")->name("admin.api.city");
        $router->get('area', "HomeController@getArea")->name("admin.api.area");
        $router->get('media_list', "MediumController@getMediaSource")->name("admin.api.media.children");
    });

    $router->resource('departments', 'DepartmentController');
    $router->resource('projects', 'ProjectController');
    $router->resource('clues', 'ClueController',[
        'names' => [
            'index' => 'admin.clues'
        ]
    ]);
    $router->resource('medium', 'MediumController');
    $router->resource('dispatch_rules', 'DispatchRuleController');
    $router->resource('media_sources', "MediaSourceController");
    $router->resource('tags', "TagController");

});
